package org.bogusware.json.editor;

import org.eclipse.jface.text.rules.*;

public class JSONPartitionScanner extends RuleBasedPartitionScanner {
	public final static String JSON_COMMENT = "__json_comment";
	public final static String JSON_OBJECT = "__json_object";

	public JSONPartitionScanner() {

		IToken jsonComment = new Token(JSON_COMMENT);
		IToken object = new Token(JSON_OBJECT);

		IPredicateRule[] rules = new IPredicateRule[3];

		rules[0] = new MultiLineRule("/*", "*/", jsonComment);
		rules[1] = new EndOfLineRule("//", jsonComment);
		rules[2] = new MultiLineRule("{", "}", object);

		setPredicateRules(rules);
	}
}
